import React from 'react'
import {Route, Switch} from 'react-router-dom'
import {connectComponent} from '../../store/utils'
import SingInContainer from './singin/SingInContainer'
import SingUpContainer from './singup/SingUpContainer'
import {UserDto} from '../../../api/UserDto'

interface AuthLayoutProps {
  user: UserDto
}

const AuthLayout: React.FC<AuthLayoutProps> = ({user}): React.ReactElement => {
  return (
    <Switch>
      <Route exact path={'/auth/singin'} component={SingInContainer} />
      <Route exact path={'/auth/singup'} component={SingUpContainer} />
    </Switch>
  )
}

export default connectComponent(
  (state) => ({
    user: state.auth.user,
  }),
  () => ({}),
  AuthLayout,
)
